]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
switcherPopup: Show immediately on second key press
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 21 Nov 2019 22:40:02 +0000 (23:40 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 21 Nov 2019 23:20:29 +0000 (00:20 +0100)
We slightly delay showing the switcher popup to avoid flashing it
briefly in the common case of quickly switching back-and-forth
between two windows.

However some users perceive this delay as slowness. Address this by
showing the popup immediately when another key press is consumed
(that is, a key like Tab is pressed).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1928

js/ui/switcherPopup.js

index 85e962ef2ca2fe3f15f6a989fd793fab39adafa7..44228ec1b3bc993c46d545ad828aeaf20d8a414d 100644 (file)
@@ -139,15 +139,24 @@ var SwitcherPopup = GObject.registerClass({
             GLib.PRIORITY_DEFAULT,
             POPUP_DELAY_TIMEOUT,
             () => {
-                Main.osdWindowManager.hideAll();
-                this.opacity = 255;
-                this._initialDelayTimeoutId = 0;
+                this._showImmediately();
                 return GLib.SOURCE_REMOVE;
             });
         GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
         return true;
     }
 
+    _showImmediately() {
+        if (this._initialDelayTimeoutId === 0)
+            return;
+
+        GLib.source_remove(this._initialDelayTimeoutId);
+        this._initialDelayTimeoutId = 0;
+
+        Main.osdWindowManager.hideAll();
+        this.opacity = 255;
+    }
+
     _next() {
         return mod(this._selectedIndex + 1, this._items.length);
     }
@@ -167,8 +176,10 @@ var SwitcherPopup = GObject.registerClass({
 
         this._disableHover();
 
-        if (this._keyPressHandler(keysym, action) != Clutter.EVENT_PROPAGATE)
+        if (this._keyPressHandler(keysym, action) != Clutter.EVENT_PROPAGATE) {
+            this._showImmediately();
             return Clutter.EVENT_STOP;
+        }
 
         // Note: pressing one of the below keys will destroy the popup only if
         // that key is not used by the active popup's keyboard shortcut